package com.tsm.picachu.common;

import com.tsm.picachu.R;

import android.app.Activity;
import android.app.Dialog;
import android.graphics.Color;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;

public class DialogMenuPause extends Dialog
{
	private Button mButtonResume = null;
	private Button mButtonQuit = null;
	
	public DialogMenuPause(final Activity activity)
	{
		super(activity);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT);

		LinearLayout contentLinearLayout = new LinearLayout(activity);
		contentLinearLayout.setBackgroundColor(Color.TRANSPARENT);
		contentLinearLayout.setGravity(Gravity.CENTER);
		contentLinearLayout.setOrientation(LinearLayout.VERTICAL);

		mButtonResume = new Button(activity);
		mButtonQuit = new Button(activity);

		mButtonResume.setOnTouchListener(new View.OnTouchListener()
		{
			public boolean onTouch(View v, MotionEvent event)
			{
				mButtonResume.setBackgroundResource(R.drawable.text_resume_hl);
				mButtonQuit.setBackgroundResource(R.drawable.text_quit);
				return false;
			}
		});

		mButtonResume.setBackgroundResource(R.drawable.text_resume_hl);
		contentLinearLayout.addView(mButtonResume);

		mButtonQuit.setOnTouchListener(new View.OnTouchListener()
		{
			public boolean onTouch(View v, MotionEvent event)
			{
				mButtonResume.setBackgroundResource(R.drawable.text_resume);
				mButtonQuit.setBackgroundResource(R.drawable.text_quit_hl);
				return false;
			}
		});
		mButtonQuit.setBackgroundResource(R.drawable.text_quit);
		contentLinearLayout.addView(mButtonQuit);

		setContentView(contentLinearLayout);
	}
	
	public void setClickListeners(View.OnClickListener resumeClickListener, View.OnClickListener quitClickListener)
	{
		mButtonQuit.setOnClickListener(quitClickListener);
		mButtonResume.setOnClickListener(resumeClickListener);
	}
	
}
